package com.ruoyi.web.controller.teacher;


import com.ruoyi.common.core.domain.R;
import com.ruoyi.domain.CommanderGrade;
import com.ruoyi.domain.Score;
import com.ruoyi.service.CommanderGradeService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/commandGrade")


public class CommanderGradeController {
    @Autowired
    private CommanderGradeService commanderGradeService;
    @GetMapping("/getCommandGradeList")
    public R list(@Param("loadingId") String loadingId)
    {
        return commanderGradeService.byCaseId(loadingId);
    }

    @PostMapping("/submitTeacher")
    public R submitTeacher(@RequestBody List<CommanderGrade> commanderGrade){
        return commanderGradeService.submitTeacher(commanderGrade);
    }

    @GetMapping("/getTeacherClass")
    public R getTeacherClass(@Param("loadingId") String loadingId)
    {
        return commanderGradeService.getTeacherClass(loadingId);
    }



    @GetMapping("/getTeacherScoreList")
    public R getTeacherScoreList(@Param("loadingId") String loadingId,@Param("positionId")Long positionId)
    {
        return commanderGradeService.getTeacherScoreList(loadingId,positionId);
    }

    @PostMapping("/addScore")
    public R addScore(@RequestBody Score score){
        return commanderGradeService.addScore(score);
    }

    @PostMapping("/updateComStatus")
    public R updateStatus(@RequestBody List<CommanderGrade> commanderGrade){
        return commanderGradeService.updateStatus(commanderGrade);
    }

    @GetMapping("/getScore")
    public R getScore(@Param("caseId")String caseId,@Param("positionId") Long positionId){
        return R.ok(commanderGradeService.getScore(caseId,positionId));
    }

    //清空上次结果 更新信号 状态
    @PostMapping("/delete")
    public R updateDeleteCaseId(@Param("caseId")String caseId){
        return R.ok(commanderGradeService.updateDeleteCaseId(caseId));
    }

    @GetMapping("/upDateUserStatus")
    public R upDateUserStatus(@RequestParam("userId")Long userId){
        return commanderGradeService.upDateUserStatus(userId);
    }

    @GetMapping("/getPlan")
    public R getPlan(@RequestParam("caseId")String caseId,@RequestParam("deptId")Long deptId){
        return commanderGradeService.getPlan(caseId ,deptId);
    }

}
